from dataclasses import dataclass
from typing import Optional, List

node = List[None]


@dataclass()
class Node:
    val: int
    left: Optional['Node'] = None
    right: Optional['Node'] = None

    def root_read(self):
        print(self.val)
        if self.left:
            self.left.root_read()
        if self.right:
            self.right.root_read()


head = Node(1)
head.left = Node(2)
head.right = Node(3)
head.left.left = Node(4)
head.root_read()